<%@ Page Language="C#" Trace="false" TraceMode="SortByTime" MasterPageFile="~/Manager/Admin/Admin.master" AutoEventWireup="true" CodeFile="List.aspx.cs" Inherits="Admin_StateFlow_Users_List" Title="User List" %>
<asp:Content ID="Content1" ContentPlaceHolderID="AC" Runat="Server">
<link href="/CSS/Outlook.css" rel="stylesheet" type="text/css" />
<asp:UpdatePanel ID="upUsers" runat="server"><ContentTemplate>
<UI:PlaceHolderJS runat="server">
<xml id="xmlUsers" runat="server"></xml>
</UI:PlaceHolderJS>
Group: <asp:DropDownList id="selGroupName" DataSourceID="dsGroups" DataTextField="Name" DataValueField="dn" runat="server" />
New user : 
<asp:TextBox id="txtNewUserName" CssClass="bigList" xmlSrc="xmlUsers" runat="server"
		 loose textField="UserName" Columns="10"
 />
Password : <asp:TextBox id="txtPassword" style="overflow-x:visible" Columns="10" autocomplete="off" runat="server" />
<asp:Button OnClick="CreateUser" runat="server" Text="Add User/Group" style="overflow-x:visible" />
<asp:Button OnClick="RemUserFromGroup" runat="server" Text="Remove From Group" style="overflow-x:visible" />
<DS:GroupsDataSource ID="dsGroups" FilterDefault="Name>'A'" runat="server" />

<UI:GridViewEx ID="grvUsers" ShowHeader="true" AllowSorting="true" AllowEdit="false" ShowDelete="false"
		DataSourceID="dsUsers" PageSize="20" AllowPaging="true" runat="server" AutoGenerateColumns="false" DataKeyNames="UserName">
		<Columns>
			<asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" />
			<asp:BoundField DataField="Nick" HeaderText="Name" SortExpression="Nick" />
			<asp:BoundField DataField="UserName" HeaderText="Login" SortExpression="UserName" />
			<asp:TemplateField HeaderText="Groups" SortExpression="Groups">
				<ItemTemplate>
					<%#Eval("Groups") %><%--Need this for sorting/filtering--%>
					<asp:Literal ID="UserDN" Text='<%#Eval("Name")%>' Visible="false" runat="server"></asp:Literal>
					<asp:ObjectDataSource FilterExpression="dn LIKE '%MotoBank%'" ID="dsUserGroups" TypeName="Dimok.Data.ADs+LDAP" SelectMethod="GetUserGroupsDS" runat="server">
					<SelectParameters>
						<asp:ControlParameter ControlID="UserDN" PropertyName="Text" Name="userDN" Type="String" />
						<asp:Parameter Name="OrderBy" DefaultValue="cn" Type="String" />
					</SelectParameters>
					</asp:ObjectDataSource>
					<asp:Repeater runat="server">
					<ItemTemplate>
						<%#Eval("cn","[{0}]")%>
					</ItemTemplate>
					</asp:Repeater>
				</ItemTemplate>
			</asp:TemplateField>
		</Columns>
</UI:GridViewEx>
<DS:UsersDataSource ID="dsUsers" EnableCaching="true" CacheKeyDependency="DSUsers"  OrderBys="Nick" ShowGroups="true" runat="server" />
</ContentTemplate></asp:UpdatePanel>
<asp:Button OnClick="GetUsers" runat="server" Text="Download Users" Visible="true" />
<asp:CheckBox ID="chkUpdateDB" runat="server" text="Update DB"/>
</asp:Content>


